<script>
  //1
  typeof Promise === "function" // 使等式成立

  //2
  const param = () => { } // param 应该为什么值才不报错？
  new Promise(param)

  //3
  new Promise((resolve, reject) => {
    // ？？？
    resolve('1234')
  }).then(r => {
    console.log(r) // 应打印'1234'
  })

  //4
  new Promise((resolve, reject) => {
    reject()
  })
    .then(() => console.log('成功'))
    .catch(() => console.log('失败'))
  // 为什么明明Promise 调用了reject()代码没有打印失败而是成功，如何改写能使catch被调用？

  //5
  // 代码为什么出错，如何修改？
  let promise5 = new Promise(resolve => {
    setTimeout(() => resolve(), 100);
  });
  promise5
    .then(() => console.log('完成'))

  //6 ??
  class MyPromise extends Promise { }
  const promise6 = new MyPromise((resolve) => {
    setTimeout(() => {
      resolve()
      // console.log(2);
    }, 3000);
  });
  promise6.then((v) => console.log('done')) // 使then里可以被执行



</script>